package com.itheima.test4;

public class GoodsTest {
    public static void main(String[] args) {
        /*定义数组存储3个商品对象
        商品的属性：商品的id，名字，价格，库存。
        创建3个商品对象，并把商品对象存入到数组当中
         */

        //创建3个商品对象
        Goods g1 = new Goods("001","小米",1999.8,100);
        Goods g2 = new Goods("002","水杯",99,10000);
        Goods g3 = new Goods("003","雨伞",88,1000);

        //定义存储Goods对象的数组
        Goods[] goodsArray = {g1, g2, g3};

        //打印看下效果
        for (int i = 0; i < goodsArray.length; i++) {
            System.out.print(goodsArray[i].getId()+" \t");
            System.out.print(goodsArray[i].getName()+" \t");
            System.out.print(goodsArray[i].getPrice()+" \t");
            System.out.print(goodsArray[i].getCount()+" \t");
            System.out.println();
        }

    }
}
